package org.coding.springbootdemoredisstandalone.rediscontroller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * ^ enjoy coding and be bugfree boy
 *
 * @author guoxh
 * @date 2020/10/30 8:07 下午
 * @desc
 **/
@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    RedisTemplate<String,String> redisTemplate;

    @GetMapping("/exec")
    public Object execute(HttpServletRequest request, HttpServletResponse response){
        try{
            redisTemplate.opsForValue().set("hello","world");
        }catch (Exception e){
            e.printStackTrace();
            System.exit(0);
        }
        return "SUCCESS";
    }
}
